package model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

public class Table {
	
	private int chipsOnTable;
	private ArrayList<Card> cards;
	private HandChain handChain;
	
	public Table(HandChain playerChain){
		chipsOnTable = 0;
		cards = new ArrayList<Card>();
		this.handChain = playerChain; // the table keeps this so it has a reference to all the players
	}
	
	public int getChips(){
		return chipsOnTable;
	}
	
	public void addChips(int amount){
		chipsOnTable += amount;
	}
	
	public ArrayList<Card> getCards(){
		return cards;
	}
	
	public void addCard(Card c){
		cards.add(c);
	}
	
	public void addCards(ArrayList<Card> c){
		cards.addAll(c);
	}
	
	public int largestBet(){
		int largestBet = 0;
		for(Player p : handChain.getPlayers()){
			if(p.getChipsOnTable() > largestBet){
				largestBet = p.getChipsOnTable();
			}
		}
		return largestBet;
	}
	
	public Collection<Player> getPlayers(){
		return handChain.getPlayers();
	}
	
}
